First of all to talk about my thinking, to copy a directory of all the files to another directory, we do not know what the directory structure is, and do not know how many layers of the directory, the number of files, so we would like to use the
Traverse all files and folders in a folder and copy the matched files to the same directory. In the following example, all the html files in the "/www/pooy/Ke" directory are copied to the "/www/pooy/bk" directory. The code is as follows:Copy code
Linux copies all files in the specified directory to another directoryCopy all files in the specified directory to another directoryThe copying of files and directories is often used. The commands for copying under Linux are CP.Assume that the
This article describes how to copy all the files in a directory to the target directory.
Here are a few of the classes that we will use in this routine:
1, Directory:exposes static methods for creating, moving, and enumerating through directories
Copy all. java files in the D:/java directory to the D:/jad directory and change the extension of the original file from. java to. jad
Import Java.io.File; Import Java.io.FileInputStream; Import Java.io.FileOutputStream; Import
There are some files and directories under the current directory, each of which has several. txt files in each directory.It is now required to create a new directory in the current directory all, and all of those directories will have a. txt fileare
Linux replicates all files in the specified directory to another directoryCopy all files in the specified directory to another directoryReplication of files and directories is often used. The command for replication under Linux is CP.Suppose the
/** * Write a program to copy all the. java files in the D:\java directory to the D:\jad directory and change the extension of the original file from. java to. jad.
* *: The Listfiles method accepts a FileFilter object, the FileFilter object is
Copy commandThe function of this command is to copy the given file or directory to another file or directory, which is as powerful as the copy command under MSDOS.
Syntax: CP [option] source file or directory destination file or directory
Because I'm bored because I'm bored ... (Why not first check if there is no ready-made orders, regret Ah!!) )Do not know to have xcopy this command, I want to write a copy subdirectory and file function ... The following story was bornIs this,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.